/*
 ============================================================================
 Name		: IapManager.h
 Author	  : 
 Version	 : 1.0
 Copyright   : BUPT
 Description : CIapManager declaration
 ============================================================================
 */

#ifndef IAPMANAGER_H
#define IAPMANAGER_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include<COMMDB.H>

static const TInt KIapNameLength = 50;
class TIapInfo
{
public:
	TBuf<KIapNameLength> iIapName;
	TUint32 iId;
};
class TWlanInfo
{
public:
	TIapInfo iIapInfo;
	TInt iSignalStrength;
	TBuf<KIapNameLength> iWlanSSID;
};

// CLASS DECLARATION
/**
 *  CIapManager
 * 
 */
class IapManager 
	{
public:
	enum TIapType
		{
		EIapCmnet,
		EIapCmwap,
		EIapUninet,
		EIapUniwap
//		EIapWinSocket
		};
	//判断当前网络为移动还是联通，为移动选择cmwap，为联通选择uniwap，其他网络设置aIapId为KMaxTUint32
	static void AutoGetIap(TUint32& aIapId);
	//得到当前所有已定义的接入点	
	static void GetAllIapList(RArray<TIapInfo>& aIapInfoList);
	
	//得到当前可用接入点列表
	static void GetAvailabilityIapList(RArray<TIapInfo>& aIapInfoList);
	
	// 判断IAP和名称是不是符合
	static TBool CheckIAPNameID(const TDesC& aName, TInt aIAP);
	
private:
	static void GetWlanIapList(RArray<TWlanInfo>& aIapInfoList);
	static void GetGPRSIapList(RArray<TIapInfo>& aIapInfoList);
	static void ListAvailabilityIapL(RArray<TUint32>& aIapList);
	
	static void GetIap(TUint32& aIapId,TIapType aType = EIapCmwap);
	static TBool SearchIap(const TDesC& aIapName, TUint32& aIapId);
	static void CreateIap(const TDesC& aIapName, TUint32& aIapId);
	static TInt CreateNewOgGprsL(CCommsDatabase& aCommsDb,
			const TDesC& aCommsdb_name_val, TUint32& aOgGprsId);
	static TInt CreateNewAccessPointL(CCommsDatabase& aCommsDb,
			const TDesC& aCommsdb_name_val, TUint32& aApId);
	};

#endif // IAPMANAGER_H
